import request from '@/utils/request.js'
export const getStudentById = (data) => {
	return request({
		url: '/student/queryById', //请求接口
		method: 'get', //请求方式
		data //请求参数
	})
}

export const loginUser = (data) => {
	return request({
		url: '/login/login', //请求接口
		method: 'post', //请求方式
		data //请求参数
	})
}
export const logout = () => {
	return request({
		url: '/login/logout', //请求接口
		method: 'get', //请求方式
	})
}

//获取新闻公告
export const getMainPageData = () => {
	return request({
		url: '/schoolInfo/all',
		method: 'get',
	})
}
//获取某个id学生的考勤次数
export const getattendancebyid = (id) => {
	return request({
		url: '/attendance/attend/' + id,
		method: 'get',
	})
}
//获取某个id学生的考勤信息
export const getallattendancebyid = (id) => {
	return request({
		url: '/attendance/attendall/' + id,
		method: 'get',
	})
}
//获取某个id学生的成绩
export const getscorebyid = (id) => {
	return request({
		url: '/grades/' + id,
		method: 'get',
	})
}

export const getMsgList =(data) =>{
	return request({
		url:'/messages/all',
		method:'post',
		data
	})
}
//写留言
export const addMsg =(data)=>{
	return request({
		url:'/messages/add',
		method:'post',
		data
	})
}

export const getuserbyrole = (data) =>{
    return request({
        url: '/users/queryByType',
        method: 'post',
        data
    })
}


//获取作业信息
export const getHomeWorks = (homeworkId) =>{
	return request({
		url:`/homework/${homeworkId}`,
		method:'get',
	})
}
//添加作业
export const setHomeWorks =(homeworkData) =>{
	return request({
		url:'/homework/add',
		method:'post',
		headers: {
			'Content-Type': 'application/json'
		},
		data:homeworkData
	})
}


//学生活动
export const getStudentActivities = () =>{
    return request({
       url:'/studentActivities/all',
       method:'get',
    })
}


export const registerUser = (data) => {
	return request({
		url: '/users/register',
		method:'post',
		data
	})
}

export const addMessage = (data)=>{
	return request({
		url:'/messages',
		method:'post',
		data
	})
}

// 管理员添加留言
export const addMMssage= (data) =>{
	return request({
		url:'/messages/add',
		method:'post',
		data
	})
}


//删除用户
export const delUser = (userId) =>{
	return request({
		url:`users/del/${userId}`,
		method:'delete',
	})
}

//获取所有信息
export const getUsers = () =>{
	return request({
		url:'/users/all',
		method:'get',
	})
}

export const getrpbyid = (id) =>{
    return request({
        url: '/RewardsPunishments/id='+id,
        method: 'get',
    })
}
export const getrpbytype = (type) =>{
    return request({
        url: '/RewardsPunishments/type='+type,
        method: 'get',
    })
}
export const getcommentbyid = (id) =>{
    return request({
        url: '/comments/id='+id,
        method: 'get',
    })
}

